def sequence(n):
    if n == 1 or n == 2:
        num = 1
    elif n == 3:
        num = 2
    else:
        num = sequence(n-1) + sequence(n-2) + sequence(n-3)
    return num

n = int(input("请输入n："))
result = sequence(n)
print("数列的第{}项为{}".format(n, result))
